package xidian.vlab.domin;

import com.fasterxml.jackson.annotation.JsonIgnore;
import xidian.vlab.domin.User.Student;

import javax.persistence.*;
import java.util.Date;

@Entity
public class VMachine {
    @Id
    private String mid;
    private String IP;
    private String username;
    private String password;
    private String status;
    private String profile;
    private String imgId;
    private String imgName;
    private Date createTime;
    private Date updateTime;
    private Date endTime;


    @ManyToOne(targetEntity = Student.class)
    @JoinColumn(name = "sid")
    private Student student;

    @ManyToOne(targetEntity = Room.class)
    @JoinColumn(name = "rid")
    private Room room;

    //////////////////////////////////////////////////////

    public VMachine(){}
    public VMachine(String mid, String IP, String username, String password, String status, String profile, String imgId, String imgName, Date createTime, Date updateTime, Date endTime, Student student, Room room) {
        this.mid = mid;
        this.IP = IP;
        this.username = username;
        this.password = password;
        this.status = status;
        this.profile = profile;
        this.imgId = imgId;
        this.imgName = imgName;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.endTime = endTime;
        this.student = student;
        this.room = room;
    }

    public String getMid() {
        return mid;
    }

    public void setMid(String mid) {
        this.mid = mid;
    }

    public String getIP() {
        return IP;
    }

    public void setIP(String IP) {
        this.IP = IP;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }


    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getProfile() {
        return profile;
    }

    public void setProfile(String profile) {
        this.profile = profile;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }

    public Room getRoom() {
        return room;
    }

    public void setRoom(Room room) {
        this.room = room;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getImgId() {
        return imgId;
    }

    public void setImgId(String imgId) {
        this.imgId = imgId;
    }

    public String getImgName() {
        return imgName;
    }

    public void setImgName(String imgName) {
        this.imgName = imgName;
    }

    @Override
    public String toString() {
        return "VMachine{" +
                "mid=" + mid +
                ", IP='" + IP + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", status=" + status +
                ", profile='" + profile + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", studentId=" + student.getSid() +
                ", roomId=" + room.getRid() +
                '}';
    }
}
